function y = createMesh(node,connectivity)
nn = size(node,1);
ne = size(connectivity,1);

ms = fem2.Mesh();

N = javaArray('fem2.Node',nn);
for i=1:nn
    N(i) = ms.addNode(fem2.Node(node(i,1),node(i,2)));
    N(i).setId(i);
end

for i=1:ne
    e = connectivity(i,:);
    nne = size(e,2);
    na = javaArray('fem2.Node',nne);
    for j=1:nne
        na(j) = N(e(j));
    end
    f = ms.addFace(fem2.Face(na));
    f.setId(i);
end

ms.setNumberOfFields(2);
y = ms;
